//
// Created by liushuai on 2020/1/30.
//

#include <algorithm>
#include <iostream>
#include "intersect.h"
vector<int> intersect(vector<int>& nums1, vector<int>& nums2){
    set<int> setNums1(nums1.begin(),nums1.end());
    set<int> setNums2(nums2.begin(),nums2.end());
    set<int> temp;
    vector<int> result(20);
    auto iter = set_intersection(setNums1.begin(),setNums1.end(),setNums2.begin(),setNums2.end(),result.begin());
    result.resize(iter-result.begin());
    for(auto elem:result)
        cout<<elem<<" "<<endl;
    return result;
}